package com.ww.gss.filter;

import java.util.HashMap;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ww.gss.exceptions.DAOException;

public class TokenDAO {
	private Logger logger = LoggerFactory.getLogger(TokenDAO.class);
	private SqlSessionTemplate sqlSessionTemplate;

	public String getToken1(String clientid) throws DAOException {
		String result;
		try {
			Map<String, String> param = new HashMap<String, String>();
			param.put("clientID", clientid);
			Map<String, String> resultmap = sqlSessionTemplate.selectOne(
					"com.ww.gss.dao.GSSTokenVOMapper.getToken", param);
			if (resultmap == null) {
				return null;
			}
			result = resultmap.get("TOKEN1");
			logger.info("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"+result);
		} catch (Exception e) {
			throw new DAOException(e);
		}
		return result;
	}

	public SqlSessionTemplate getSqlSessionTemplate() {
		return sqlSessionTemplate;
	}

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

}
